package pl.nazaweb.imedproplus.business.service;

import java.util.List;
import javax.ejb.EJB;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import pl.nazaweb.imedproplus.model.entity.Staff;
import pl.nazaweb.imedproplus.model.facade.StaffFacade;

@Stateless
@LocalBean
public class StaffService {

    @EJB
    private StaffFacade staffFacade;

    public List<Staff> getStaffList() {
        return this.staffFacade.findAll();
    }

    public void addNewStaffs(List<Staff> staffs) {
        for (Staff staff : staffs) {
            this.addNewStaff(staff);
        }
    }

    public void addNewStaff(Staff p) {
        p.setId(null);
        this.staffFacade.create(p);
    }

    public void removeStaffs(List<Staff> staffs) {
        for (Staff staff : staffs) {
            this.removeStaff(staff);
        }
    }

    public void removeStaff(Staff p) {
        this.staffFacade.remove(p);
    }

    public void updateStaffs(List<Staff> staffs) {
        for (Staff staff : staffs) {
            this.staffFacade.edit(staff);
        }
    }

    public void updateStaff(Staff p) {
        this.staffFacade.edit(p);
    }
}
